package com.itheima.mapper;

import com.itheima.bean.Student;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Delete;

import java.util.List;

/*
 * 使用mybatis注解开发
 * */
public interface StudentMapper {
    //查询全部学生
    List<Student> selectAll();

    //高级查询,通过id进行查询
    Student selectById(String number);

    //添加学生
    @Select("insert into student values (#{number},#{name},#{birthday},#{address}")
    void addStudent(Student student);

    //修改学生
    @Update("UPDATE student SET number=#{number},name=#{name},birthday=#{birthday},address=#{address} WHERE number=#{number}")
    void updateStudent(Student student);

    //删除学生
    @Delete("DELETE FROM student WHERE number = #{number}")
    void deleteStudent(String number);
}
